package com.woniuxy.spring;

import com.woniuxy.person.Person;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

/**
 * @author: admin  <br/>
 * Date: 2022/1/17:15:39  <br/>
 * Description:
 */

public class SpringTest {
    public static void main(String[] args) {
        //获得配置文件 得到工厂
        BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));

        //使用配置文件里面的bean的id名来调用
        Person chinese = (Person) beanFactory.getBean("chinese");
        Person chinese2 = (Person) beanFactory.getBean("chinese");
        chinese.eat();
    }
}
